/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * gftp-config.h
 *
 * Copyright (C) 2008, 2009 Lingtao Pan
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, 
 * Boston, MA 02111-1307, USA.
 */

#ifndef GFTP_CONFIG_H
#define GFTP_CONFIG_H

enum {
    GFTP_CONFIG_TYPE_STRING,
    GFTP_CONFIG_TYPE_STRING_LIST,
    GFTP_CONFIG_TYPE_INT,
    GFTP_CONFIG_TYPE_BOOLEAN,
    GFTP_CONFIG_TYPE_DOUBLE
};

typedef struct gftp_config_item gftp_config_item;

struct gftp_config_item
{
    char    *group; 
    char    *key;
    char    *description;
    int     type; 
    void    *value;
    char    *comment;     /* Comment to write out to the config file */
};


void gftp_config_register_items (gftp_config_item *items);

int gftp_config_load ();
int gftp_config_save ();

gchar*   gftp_config_get_string  (const char *group, const char *key);
void     gftp_config_set_string  (const char *group, const char *key, 
                                  const char *string);
gboolean gftp_config_get_boolean (const char *group, const char *key);
void     gftp_config_set_boolean (const char *group, const char *key, 
                                  gboolean value);
gdouble  gftp_config_get_double  (const char *group, const char *key);
void     gftp_config_set_double  (const char *group, const char *key, 
                                  gdouble value);

int      gftp_config_get_integer (const char *group, const char *key);
void     gftp_config_set_boolean (const char *group, const char *key, 
                                  int value);


#endif
